{
  "properties" : { },
  "id" : "06366e82d9b14e1aa046131d2ddc0163",
  "script" : null,
  "groupId" : "5b4c0f1fcedc4bfbbf84bb3791e01399",
  "name" : "删除告警规则",
  "createTime" : 1727070933466,
  "updateTime" : 1726733444353,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "remove",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\n    \"ids\":\"40\"\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": 0\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }
}
================================
import redis
import cn.hutool.core.util.StrUtil

ids = body.ids::string
idList = ids.split(",")
sql = """ 
            select met.code from alarm_rule ru
            left join alarm_metric met on met.id = ru.rule_metric_id
            where ru.id in 
            <foreach collection="idList" open="(" separator="," close=")" item="item">
                #{item}
            </foreach>
        """
codeList = db.selectOne(sql)
if (codeList != null && codeList.size() > 0) {
    for (item in codeList) {
        redis.delete("ndmp-alarm-rule:" + item)
    }
}
// 批量删除，返回删除条数
return db.update("""
        delete from alarm_rule where id in 
        <foreach collection="idList" open="(" separator="," close=")" item="item">
            #{item}
        </foreach>
    """)